export default {
  namespace: 'menu',

  state: {
    menuData: [],
    menuRouteArr: [],
    useNavTab: false,
    curNavTab: {},
    navTabList: [],
  },

  effects: {
  },

  reducers: {
    saveMenuData(state, { payload }) {
      return {
        ...state,
        menuData: payload,
      }
    },
    saveMenuRouteArr(state, { payload }) {
      return {
        ...state,
        menuRouteArr: payload,
      }
    },
    saveCurNavTab(state, { payload }) {
      return {
        ...state,
        curNavTab: payload,
      }
    },
    saveNavTabList(state, { payload }) {
      return {
        ...state,
        navTabList: payload,
      }
    },
    changeUseNavTab(state) {
      return {
        ...state,
        useNavTab: !state.useNavTab,
        curNavTab: {},
        navTabList: [],
      }
    },
    clear(state) {
      return {
        ...state,
        curNavTab: {},
        navTabList: [],
      }
    },
  },

  subscriptions: {
    setup({ dispatch, history }) {  // eslint-disable-line
    },
  },
}
